import javax.servlet.*;
import javax.servlet.annotation.WebFilter;
import java.io.IOException;

/***************************
 FileAction:

 CreateTime:2022-05-10 10:04
 Author:Aaking-aline
 ****************************/
@WebFilter("/*")
public class Filter implements javax.servlet.Filter {
    public void destroy() {
    }

    public void doFilter(ServletRequest req, ServletResponse resp, FilterChain chain) throws ServletException, IOException {
        // 设置request对象编码表
        req.setCharacterEncoding("UTF8");
        //resp.setCharacterEncoding("UTF8");
        // 设置response缓冲区编码表 通知浏览器的解码
        resp.setContentType("text/html;charset=UTF-8");
        chain.doFilter(req, resp);
    }

    public void init(FilterConfig config) throws ServletException {

    }

}
